/**
 * Copyright (c) 2013-Now http://jeesite.com All rights reserved.
 * No deletion without permission, or be held responsible to law.
 * @author dong
 */
import { defHttp } from '/@/utils/http/axios';
import { useGlobSetting } from '/@/hooks/setting';
import {BasicModel, Page, TreeDataModel} from '/@/api/model/baseModel';

const { adminPath } = useGlobSetting();

export interface JydqCategory extends BasicModel<JydqCategory> {
  name?: string; // 分类名称
  viewCount?: number; // 浏览次数
  comparisonsCount?: number; // 比价次数
}

export const jydqCategoryList = (params?: JydqCategory | any) =>
  defHttp.get<JydqCategory>({ url: adminPath + '/jydq/category/list', params });

export const jydqCategoryListData = (params?: JydqCategory | any) =>
  defHttp.post<Page<JydqCategory>>({ url: adminPath + '/jydq/category/listData', params });

export const jydqCategoryForm = (params?: JydqCategory | any) =>
  defHttp.get<JydqCategory>({ url: adminPath + '/jydq/category/form', params });

export const jydqCategorySave = (params?: any, data?: JydqCategory | any) =>
  defHttp.postJson<JydqCategory>({ url: adminPath + '/jydq/category/save', params, data });

export const jydqCategoryDelete = (params?: JydqCategory | any) =>
  defHttp.get<JydqCategory>({ url: adminPath + '/jydq/category/delete', params });

export const categoryTreeData = (params?: any) =>
  defHttp.get<TreeDataModel[]>({ url: adminPath + '/jydq/category/treeData', params });
